import request from '@/utils/request';

const api = {
	LIST: '/shop/cart_list',
	ADD: '/shop/cart_add',
	UPDATE: '/shop/cart_update',
	DEL: '/shop/cart_del',
	ITEM_NUM: '/shop/cart_item_num',
	SELLTE_AMOUNT: '/shop/cart_settle_amount',
}

export async function cartList(queryParams) {
	return request.get(api.LIST, queryParams);
}

export async function cartItemNum() {
	return request.get(api.ITEM_NUM);
}

export async function cartSettleAmount(ids) {
	let params = {
		ids: ids
	};
	return request.post(api.SELLTE_AMOUNT, params);
}

export async function cartAdd(productId, skuId, num) {
	let params = {
		productId: productId,
		skuId: skuId,
		num: num
	};
	return request.post(api.ADD, params);
}

export async function cartUpdate(id, num) {
	let params = {
		id: id,
		num: num
	};
	return request.post(api.UPDATE, params);
}

export async function cartDel(id) {
	let params = {
		id: id
	};
	return request.post(api.DEL, params);
}



